Ext.ns('AIR2.Import.Resolve');
/***************
 * Import Resolver SrcPhoneNumber Panel
 *
 * A panel that allows conflict resolution of SrcPhoneNumber
 *
 * @param {Object} data
 * @param {String} model
 * @param {Integer} conWith
 */
AIR2.Import.Resolve.SrcPhoneNumber = function(data, model, conWith) {
    // get the resource URL for the phone numbers
    var phoneUrl = null;
    var ops = 'ADD|IGNORE';
    if (data.src_uuid) {
        phoneUrl = AIR2.HOMEURL + '/source/' + data.src_uuid + '/phone';
        if (conWith) {
            phoneUrl += '/'+conWith; //conflict with specific phone
            ops += '|REPLACE';
        }
        phoneUrl += '.json';
    }

    return new AIR2.Import.Resolve.ConflictRow({
        model: 'SrcPhoneNumber',
        tpl: new Ext.XTemplate(
            '<ul><tpl for=".">' +
                '<tpl if="sph_primary_flag"><li class="sph_primary_flag"><b>Primary:</b> {[AIR2.Format.bool(values.sph_primary_flag)]}</li></tpl>' +
                '<tpl if="sph_context"><li class="sph_context"><b>Type:</b> {sph_context}</li></tpl>' +
                '<tpl if="sph_country"><li class="sph_country"><b>Country:</b> {sph_country}</li></tpl>' +
                '<tpl if="sph_number"><li class="sph_number"><b>Number:</b> {sph_number}</li></tpl>' +
                '<tpl if="sph_ext"><li class="sph_ext"><b>Ext:</b> {sph_ext}</li></tpl>' +
            '</tpl></ul>',
            {compiled:true, disableFormats:true}
        ),
        currUrl: phoneUrl,
        currEmptyText: 'No Phone Numbers',
        newData: data,
        validOps: ops
    });
}